home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / misc / nosey.a00 < prev    next >
Text File  |  1996-11-17  |  3KB  |  169 lines

  1. :
  2. #!/bin/bash
  3. #
  4. # briefme - top package agent. Copyright (c) 1993 (Gil Nardo)
  5. #    see files in subdir ./legal for legalease
  6.  
  7. _briefme()
  8. {
  9. #
  10. # README starts here
  11. #
  12.  
  13. more <<-TOHERE
  14.  
  15.     This is the top level directory for the nosey package.
  16.     The programs from this package are used to diagnose your
  17.     linux mouse device.
  18.  
  19.     The README file doubles as both a README and an Bash executable
  20.     package agent -- a program that helps navigate, explain, and
  21.     maintain parts of a software package. { Package Agent (tm) :-) }
  22.  
  23.     For those who do not have the command shell 'Bash', or have
  24.     trouble using this script, or wish to go straight to using
  25.     the package, here are the manual directions to follow to get
  26.     you going, ASAP.
  27.  
  28.     1) cd to ..../src
  29.     2) validate or modify makefile defines for your system tools
  30.     3) execute make
  31.     4) execute nosey
  32.  
  33.  
  34.     The files located at this level are
  35.  
  36.     README*        readable bash executable package agent
  37.     briefme*    bash executable package agent
  38.  
  39.     The subdirectories visible from this level are
  40.  
  41.     src/        source code to nosey
  42.     bin/        directory for package targets/executables
  43.     doc/        contains things we hope you'll eventually read
  44.     agents/        contains utilities for package agents
  45.     legal/        holds legal sorts of documents
  46.     tmp/        temp dir for manifest checks and misc stuff
  47.     archive/    storage for tar or zipped files
  48.  
  49.     Note: tmp/ and archive/ are usually not sent with the distribution.
  50.  
  51. TOHERE
  52.  
  53. #
  54. # README ends here
  55. #
  56.     echo -n "Press <ENTER>: "
  57.     read yn
  58. }
  59.  
  60.  
  61.  
  62.  
  63. # Prompt for yes or no answer - returns non-zero for no
  64. _getyn()
  65. {
  66.         while   echo -n "$* (y/n) ">&2
  67.         do      read yn rest
  68.                 case $yn in
  69.                 [yY])   return 0                      ;;
  70.                 [nN])   return 1                      ;;
  71.                 *)      echo "Please answer y or n" >&2 ;;
  72.                 esac
  73.         done
  74. }
  75.  
  76. # look for an archive sitting with the README file
  77. _check_archive()
  78. {
  79.     local ARCNAME
  80.     local ARCPLACE
  81.     local PACKPLACE
  82.  
  83.     PACKPLACE=nosey
  84.     ARCNAME=$1
  85.  
  86.     if [ ! -f $ARCNAME ]
  87.     then return
  88.     fi
  89.  
  90.     echo Archive file ${ARCNAME} is available
  91.  
  92.     case $ARCNAME in
  93.  
  94.         *.taz)
  95.             if (_getyn "Extract files from gzipped tar?")
  96.             then
  97.                 tar -zxvf $ARCNAME
  98.             fi
  99.             ;;
  100.  
  101.         *.tgz | *.tpz)
  102.             if (_getyn "Reverse gzip then extract from tar?")
  103.             then
  104.                 gunzip < $ARCNAME | tar -xvf -
  105.             fi
  106.             ;;
  107.  
  108.         *.tar)
  109.             if (_getyn "Extract files from tar?")
  110.             then
  111.                 tar xvf $ARCNAME
  112.             fi
  113.             ;;
  114.  
  115.         *)
  116.             echo Dont know how to handle archive file $ARCNAME
  117.             return
  118.             ;;
  119.     esac
  120.  
  121.     ARCPLACE=$PACKPLACE/archive
  122.  
  123.     if [ ! -d $PACKPLACE ]
  124.     then    return
  125.     fi
  126.  
  127.     if (_getyn "Move $ARCNAME to directory $ARCPLACE?")
  128.     then
  129.         if [ ! -d  $ARCPLACE ]
  130.         then
  131.             echo Making directory $ARCPLACE
  132.             mkdir $ARCPLACE
  133.         fi
  134.         if [ ! -d $ARCPLACE ]
  135.         then
  136.             echo Could not create $ARCPLACE directory
  137.             return
  138.         fi
  139.         mv $ARCNAME $ARCPLACE
  140.     fi
  141.     if [ -d $PACKPLACE ]
  142.     then
  143.         echo Changing directory to package directory $PACKPLACE
  144.         cd $PACKPLACE;
  145.     fi
  146.     ./agents/manifest.bsh
  147. }
  148.  
  149. #
  150. # main()
  151. #
  152.     QUICKLY=$1
  153.  
  154.     _briefme
  155.  
  156.     if [ -z "$BASH_VERSION" ]
  157.     then
  158.         echo "I want to be bash'd!"
  159.         _getyn "Continue running in this shell anyway?" || exit
  160.     fi
  161.  
  162.     _check_archive `echo *.tgz`
  163.  
  164.     if [ ! -z "$QUICKLY" ]
  165.     then exit
  166.     fi
  167.  
  168.     ./briefme
  169.